﻿// Mixer.cs (c) Copyright 2009, Mike Hodnick : www.hodnick.com
	
using System.Collections.Generic;

namespace Kindohm.KSynth.Library
{
    public class Mixer : ISampleMaker
    {
        public Mixer()
        {
            this.Inputs = new List<ISignalChainComponent>();
        }

        public List<ISignalChainComponent> Inputs { get; protected set; }
        public ISampleMaker Output { get; set; }

        public StereoSample GetSample()
        {
            StereoSample newSample = new StereoSample();
            for (int i = 0; i < this.Inputs.Count; i++)
            {
                StereoSample sample = this.Inputs[i].GetSample();
                newSample.LeftSample += sample.LeftSample;
                newSample.RightSample += sample.RightSample;
            }

            return newSample;
        }

    }
}
